package com.koron.css2.newProjectCenter.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.newProjectCenter.bean.query.PjInfoQueryBean;
import com.koron.css2.newProjectCenter.mapper.PjInfoMapper;
import com.koron.css2.newProjectCenter.vo.PjAdjustDetailVO;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

/**
 * 补录预缴款详情
 * @author xusheng
 */
public class PjAdjustQuery  implements ServerInterface {
	@Override
	public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
		try {
			//将入参转换为QueryBean
			PjInfoQueryBean queryBean = JsonUtils.objectToPojo(req.getData(), PjInfoQueryBean.class);
			PjInfoMapper pjInfoMapper = factory.getMapper(PjInfoMapper.class);
			PjAdjustDetailVO vo = pjInfoMapper.selectAdjustDetail(queryBean.getId());
			MessageBean<PjAdjustDetailVO> info = MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "查询成功", PjAdjustDetailVO.class);
			info.setData(vo);
			return info;
		} catch (Exception e) {
			logger.error("工程款调整详情查询失败"+e.getMessage(), e);
			return MessageBean.create(Constant.MESSAGE_INT_FAIL, "工程款调整详情查询失败", null);
		}
	}
}
